home *** CD-ROM | disk | FTP | other *** search
/ SPACE 1 / SPACE - Library 1 - Volume 1.iso / program / 113 / gfatip01 / gfatip01.txt
Text File  |  1987-11-28  |  2KB  |  84 lines

  1.  
  2. GFA TIP01:
  3.  
  4.      By John B. Holder
  5.      Senior Software Engineer
  6.      Marathon Computer Press
  7.  
  8.      This short file will show you the two ways to tell if the 
  9. printer connected to your system is ready to receive data or not.
  10.  
  11.      The first method, { The way discussed in the GFA Basic 
  12. Manual} uses the OUT? command, and the second way utilizes the low 
  13. level GEMDOS c_prnos System call.  So without further ado let's 
  14. take a look at the two methods and what they do for you.
  15.  
  16.  
  17. Using the OUT? Command:
  18.  
  19.      By using the following code snip you can determine if your 
  20. printer is hooked up and ready to receive data.
  21.  
  22.                     Out 0,0
  23.                     If Out?(0)
  24.                       Ok=1
  25.                       Else
  26.                       Ok=-1
  27.                     Endif
  28.  
  29.                     If Ok=-1
  30.                     Alert 1," Printer is not on! ",1," OK ",reply%
  31.                     Else
  32.                     Alert 1," Everything's O.K. ",1," OK ",reply%
  33.                     Endif
  34.  
  35.                     end
  36.  
  37. Positive points:
  38.  
  39.      This method will work not only with the printer port, but 
  40. also with the AUX (1) port and the MID (3) port.  To check those 
  41. ports just use Out?(1) or Out?(3). 
  42.  
  43. Bad Point:
  44.  
  45.      If the printer is not connected, you will have to wait for 30 
  46. seconds for the control of the console to be returned to the 
  47. application.  It is for this reason that this method may not be 
  48. the one of choice for most applications.
  49.  
  50.  
  51. The c_prnos Substitute call:
  52.  
  53.      Try this procedure out:
  54.  
  55.           Procedure C_prnos
  56.           Status%=Gemdos(&H11)
  57.           Return
  58.  
  59.      If your printer is connected to the system and ready to 
  60. receive data, the value assigned to the Status% variable will be 
  61. a negative 1 (-1).  If the printer isn't ready, you'll find a zero 
  62. (0) in the variable upon return.
  63.  
  64. Positive Point:
  65.  
  66.      This call only takes an instant to register an answer, 
  67. instead of the 30 seconds recorded above if there is a problem.
  68.  
  69.  
  70. Weak Point:
  71.  
  72.      This call will function with only the printer port, and not 
  73. MID port.
  74.  
  75.  
  76.  
  77.      I hope this small doc file has helped some of you.  I will 
  78. try to address questions in this manner in Future GFATIPxx.DOC 
  79. files.  Please U/L your own tip files to the MichTron Libraries if 
  80. so desired.  I ask that you use some other naming convention 
  81. besides the GFATIPxx.DOC one though so there will not be any 
  82. confusion.
  83.  
  84.